window.addEventListener("keypress", keypressed, false);
window.addEventListener("load",myOnLoadFunction);
var currentcell;
 

function test(){
	return 1;
}

function myOnLoadFunction(){
		currentcell = document.getElementById("solutionfield");
		currentcell.value = ""
}

function inverse(){
	currentcell.value = 1/currentcell.value
}

function sqrt(){
	currentcell.value = Math.sqrt(currentcell.value)
}
function setDefault(){
document.getElementById("solutionfield").value = ""
}

function backspace(){
	if(currentcell.value.length > 0){
		currentcell.value = currentcell.value.substring(0, currentcell.value.length-1)
	}
	
}

function increase(cell){
	currentcell.value = currentcell.value + cell.value;
}

function keypressed(event){
	if(!(event.keyCode > 57 || event.keyCode < 48)){
		currentcell.value = currentcell.value + String(event.keyCode-48);
	}
}

function equals(){
	currentcell.value = eval(currentcell.value)
}

